<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
	$imagePath = JURI::base(true) . "/components/com_articlecashrewards/assets/images/";
	$images	= array();
	
	$review->path 		= $imagePath . "/review-48.png";
	$review->title		= "CPANEL_REVIEW";
	$review->href		= "index.php?option=com_articlecashrewards&controller=approval&task=pendingreview";
	$images[]			= $review;

	$approved->path 	= $imagePath . "/approved-48.png";
	$approved->title	= "CPANEL_APPROVED";
	$approved->href		= "index.php?option=com_articlecashrewards&controller=listing&task=approved";
	$images[]			= $approved;

	$rejected->path 	= $imagePath . "/rejected-48.png";
	$rejected->title	= "CPANEL_REJECTED";
	$rejected->href		= "index.php?option=com_articlecashrewards&controller=rejected&task=rejected";
	$images[]			= $rejected;

	$weblinks->path 	= $imagePath . "/weblinks-48.png";
	$weblinks->title	= "CPANEL_WEBLINKS";
	$weblinks->href		= "index.php?option=com_articlecashrewards&controller=weblinks&task=pending";
	$images[]			= $weblinks;

	$referrals->path 	= $imagePath . "/referral-48.png";
	$referrals->title	= "CPANEL_REFERRALS";
	$referrals->href	= "index.php?option=com_articlecashrewards&controller=referrals&task=pending";
	$images[]			= $referrals;

	$awards->path 		= $imagePath . "/adhoc-48.png";
	$awards->title		= "CPANEL_ADHOC";
	$awards->href		= "index.php?option=com_articlecashrewards&controller=awards&task=adhoc";
	$images[]			= $awards;

	$reports->path 		= $imagePath . "/reports-48.png";
	$reports->title		= "CPANEL_REPORTS";
	$reports->href		= "index.php?option=com_articlecashrewards&controller=reports&task=userearnings";
	$images[]			= $reports;

	$config->path 		= $imagePath . "/config-48.png";
	$config->title		= "CPANEL_CONFIG";
	$config->href		= "index.php?option=com_articlecashrewards&controller=config";
	$images[]			= $config;

	$support->path 		= $imagePath . "/support-48.png";
	$support->title		= "CPANEL_SUPPORT";
	$support->href		= "index.php?option=com_articlecashrewards&controller=acrsupport&task=support";
	$images[]			= $support;

?>
<table class="contentpaneopen" width="100%">
	<tr>
		<td width="45%" valign="top">
    		<div id="cpanel">
    			<?php
    			foreach($images as $image){ ?>
    				<div class="icon">
    					<a href="<?php echo $image->href; ?>">
    						<img src="<?php echo $image->path; ?>" alt="<?php echo $image->title; ?>" align="top" border="0" />
    						<span><?php echo JText::_( $image->title ); ?></span>
    					</a>
    				</div>
    			<?php } ?>
    		</div>
		</td>
        <td width="55%" valign="top">
            <?php
            echo $this->pane->startPane( 'pane' );

            echo $this->pane->startPanel( JText::_('TITLE_PENDING_ARTICLES'), 'cpanel-panel-pending' );
            if($this->pending){

              echo "<table class=\"adminlist\"><tr>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_TITLE')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_SECTION')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_CATEGORY')."</strong></td></tr>";
              $cat_link = '';
              $sect_link = '';

              foreach($this->pending as $row){
                $href = JRoute::_('index.php?option=com_articlecashrewards&controller=process&cid='.$row->id.'&redirect=1');
				// section handling
				if ($row->sectionid) {
					$sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid );
					$title_sec		= JText::_( 'TOOLTIP_EDIT_SECTION' );
				}

				// category handling
				if ($row->catid) {
					$cat_link 	= JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid );
					$title_cat		= JText::_( 'TOOLTIP_EDIT_CATEGORY' );
				}
                echo "<tr>";
                echo "<td><a href=\"".$href."\">".$row->title."</a></td>";
                echo "<td><a href=\"".$sect_link."\">".$row->section."</a></td>";
                echo "<td><a href=\"".$cat_link."\">".$row->category."</a></td>";
                echo "<tr>";
              }
              echo "</table>";
            }
            echo $this->pane->endPanel();

            echo $this->pane->startPanel( JText::_('TITLE_APPROVED_ARTICLES'), 'cpanel-panel-approved' );
            if($this->approved){
              echo "<table class=\"adminlist\"><tr>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_TITLE')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_SECTION')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_CATEGORY')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_POINTS')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_CASH')."</strong></td></tr>";
              foreach($this->approved as $row){
                $href = JRoute::_('index.php?option=com_articlecashrewards&controller=process&cid='.$row->id.'&redirect=1');
				// section handling
				if ($row->sectionid) {
					$sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid );
					$title_sec		= JText::_( 'TOOLTIP_EDIT_SECTION' );
				}

				// category handling
				if ($row->catid) {
					$cat_link 	= JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid );
					$title_cat		= JText::_( 'TOOLTIP_EDIT_CATEGORY' );
				}
                echo "<tr>";
                echo "<td><a href=\"".$href."\">".$row->title."</a></td>";
                echo "<td><a href=\"".$sect_link."\">".$row->section."</a></td>";
                echo "<td><a href=\"".$cat_link."\">".$row->category."</a></td>";
                echo "<td>".$row->points."</td>";
                echo "<td>".$row->cash."</td>";
                echo "<tr>";
              }
              echo "</table>";
            }
            echo $this->pane->endPanel();

            echo $this->pane->startPanel( JText::_('TITLE_REJECTED_ARTICLES'), 'cpanel-panel-rejected' );
            if($this->rejected){
              echo "<table class=\"adminlist\"><tr>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_TITLE')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_SECTION')."</strong></td>";
              echo "<td class=\"title\"><strong>".JText::_('LABEL_CATEGORY')."</strong></td></tr>";
              foreach($this->rejected as $row){
                $href = JRoute::_('index.php?option=com_articlecashrewards&controller=process&cid='.$row->id.'&redirect=1');
				// section handling
				if ($row->sectionid) {
					$row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid );
					$title_sec		= JText::_( 'TOOLTIP_EDIT_SECTION' );
				}

				// category handling
				if ($row->catid) {
					$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid );
					$title_cat		= JText::_( 'TOOLTIP_EDIT_CATEGORY' );
				}
                echo "<tr>";
                echo "<td><a href=\"".$href."\">".$row->title."</a></td>";
                echo "<td><a href=\"".$row->sect_link."\">".$row->section."</a></td>";
                echo "<td><a href=\"".$row->cat_link."\">".$row->category."</a></td>";
                echo "<tr>";
              }
              echo "</table>";
            }
            echo $this->pane->endPanel();

            echo $this->pane->startPanel( 'Donate', 'cpanel-panel-donate' );
              echo "<table class=\"adminlist\"><tr>";
              echo "<td class=\"title\"><strong>".JText::_('DONATE_DESC')."</strong></td></tr>";
              echo "<tr><td>";
            ?>
              <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
                <input name="cmd" value="_donations" type="hidden">
                <input name="business" value="nag_sunny@yahoo.com" type="hidden">
                <input name="item_name" value="Donation for supporting development of Joomla extensions" type="hidden">
                <input name="no_shipping" value="0" type="hidden">
                <input name="no_note" value="1" type="hidden">
                <input name="currency_code" value="USD" type="hidden">
                <input name="tax" value="0" type="hidden">
                <input name="bn" value="PP-DonationsBF" type="hidden">
                <input src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">
                <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" height="1" width="1">
              </form>
            <?php
            echo "</td></tr></table>";
            echo $this->pane->endPanel();
            echo $this->pane->endPane();
            ?>
        </td>
	</tr>
</table>